package com.yopinclub.util;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPreferencesManager {

	private SharedPreferences				mPreference;

	private static final String				KEY_APP			= "yopinclub";
	
	private static final String				KEY_LOGIN_USER	= "key_login_user";

	private static SharedPreferencesManager	instance;

	private SharedPreferencesManager() {}

	public static SharedPreferencesManager getInstance() {
		if (instance == null) {
			instance = new SharedPreferencesManager();
		}
		return instance;
	}

	public void setLoginUser(String username, Context context) {
		mPreference = context.getSharedPreferences(KEY_APP, Context.MODE_PRIVATE);
		mPreference.edit().putString(KEY_LOGIN_USER, username).commit();
	}

	public String getLoginUser(Context context) {
		mPreference = context.getSharedPreferences(KEY_APP, Context.MODE_PRIVATE);
		return mPreference.getString(KEY_LOGIN_USER, "");
	}

}
